package cn.com.nes.site.controller.system;

import cn.com.nes.site.controller.system.vo.GetActiveDetailVO;
import cn.com.nes.site.controller.system.vo.GetPosterDetailVO;
import cn.com.nes.site.controller.system.vo.SaveActiveVO;
import cn.com.nes.site.controller.system.vo.SavePosterVO;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.service.system.h5.NewH5Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Api(tags = {"H5模块-活动/海报管理"})
@Controller
@RequestMapping("/v2/h5")
public class H5Controller {

    @Resource
    private NewH5Service newH5Service;


    @ApiOperation(value = "查询海报详情 （带自定义按钮）", notes = "查询海报详情 （带自定义按钮）")
    @RequestMapping(value = "/getDynamicPosterDetail",method = RequestMethod.GET)
    public @ResponseBody PageData getPosterDetail(@Validated GetPosterDetailVO vo) throws Exception {
        return newH5Service.getPosterDetail(vo);
    }


    @ApiOperation(value = "保存海报信息 （带自定义按钮）", notes = "保存海报信息 （带自定义按钮）")
    @RequestMapping(value = "/saveDynamicPoster",method = RequestMethod.POST)
    public @ResponseBody PageData savePoster(@RequestBody @Validated SavePosterVO vo) throws Exception {
        return newH5Service.savePoster(vo);
    }

    @ApiOperation(value = "查询活动模板信息", notes = "查询活动模板信息")
    @RequestMapping(value = "/getActiveDetail",method = RequestMethod.GET)
    public @ResponseBody PageData getActiveDetail(@Validated GetActiveDetailVO vo) throws Exception {
        return newH5Service.getActiveDetail(vo);
    }

    @ApiOperation(value = "保存活动模板", notes = "保存活动模板")
    @RequestMapping(value = "/saveActive",method = RequestMethod.POST)
    public @ResponseBody PageData saveActive(@RequestBody @Validated SaveActiveVO vo) throws Exception {
        return newH5Service.saveActive(vo);
    }

}
